package com.yc.blog.springboot.mixview.ctr;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.yc.blog.springboot.mixview.service.DemoService4;

/**
 * 查看ApplicationContext
 */
@RestController
public class DemoController4 {
	
	@Autowired
	private ApplicationContext applicationContext;
	
	@RequestMapping("/c4-1")
	public String c1() {
		System.out.println("--------c4-1---------");
		
		DemoService4 c1 = (DemoService4) applicationContext.getBean("demoService4");
		DemoService4 c2 = (DemoService4) applicationContext.getBean(DemoService4.class);
		
		System.out.println(c1.equals(c2));
		
		return "success";
	}
	
	@RequestMapping("/c4-2")
	public String c2(@RequestParam String abc) {
		System.out.println("--------c4-2---------abc=" + abc);
		
		
		return "success";
	}
	
}
